﻿CREATE TABLE [RestartFramework].[ETLJobStage]
(
	[ETLJobStageId]				SMALLINT			NOT NULL
,	[ETLJobStageName]			SYSNAME				NOT NULL
,	[ETLJobId]					SMALLINT			NOT NULL
,	[ETLJobStageOrder]			SMALLINT			NOT NULL
,	[ETLJobStageEnabled]		BIT					NOT NULL
,	[ETLJobStageIsComplete]		BIT					NOT NULL	DEFAULT CONVERT(BIT,0)
,	[ETLJobStageCreatedDate]	DATETIMEOFFSET(7)	NOT NULL	DEFAULT SYSDATETIME()
,	CONSTRAINT [PK_RestartFrameworkETLJobStage] PRIMARY KEY ([ETLJobStageId]) 
,	CONSTRAINT [UK_RestartFrameworkETLJobStage_ETLJobIdETLJobStageName] UNIQUE ([ETLJobId],[ETLJobStageName])
,	CONSTRAINT [FK_RestartFrameworkETLJobStage_REF_RestartFrameworkETLJob] FOREIGN KEY ([ETLJobId]) REFERENCES [RestartFramework].[ETLJob]([ETLJobId])
)
